<?php

namespace App\Http\Controllers\home;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
class ChanpinController extends Controller
{
    
    public function Index()
     {
       // 网站开关
     if(session('web') == 2){
        // 关闭状态
        $webconfig = DB::table('webconfig') -> first();
        return view('home/webconfig/index',['webconfig'=> $webconfig]);
       }else{
               //产品 首页
     $photo = DB::table('photo') ->where('cate','2')-> first();
     // dd($photo);  
       // 查询 R 型数据
     $dataR = DB::table('goods')->where('model','like','%'.'R'.'%') ->where('status','1') -> get();
       // dd($dataR);
     // 查询 A型数据
     $dataA = DB::table('goods')->where('model','like','%'.'A'.'%') ->where('status','1')-> get();
   
        return view('home/chanpin/index',['photo'=>$photo,'dataR'=>$dataR,'dataA'=>$dataA]);
       }

    }
}
